﻿<?xml version="1.0" encoding="utf-8" ?>
<Workflow Name="Inventory" Type="Production" StartActivity="PurchaseOrderCreation" EndActivity="End">
  <Activities>
    <Activity Name="PurchaseOrderCreation" NextActivity="ROLValidation" State="PurchaseOrderCreation" PreviousActivity="None">
      <Actions>
        <Action Name="SavePurchaseOrder" ResultantActivity="PurchaseOrderCreation" ActionClass="">
          <Conditions>
            <Condition  ResultantActivity="ROLValidation" ActionClass="com.eforceglobal.MailSystem.MailManager, com.eforceglobal.MailSystem">
              <SubCondition AttributeName="ItemQuantity" ConditionKey="lessthan" Value1='100' Value2='' DataType='long'/>
            </Condition>
          </Conditions>
        </Action>
        <Action Name="SubmitPurchaseOrder" ResultantActivity="ROLValidation">
          <Conditions>
            <Condition  ResultantActivity="PurchaseOrderSentToVendor" ActionClass="">
              <SubCondition AttributeName="ItemQuantity" ConditionKey="lessthanequal" Value1='50' Value2='' DataType='long'/>
            </Condition>
          </Conditions>
        </Action>
      </Actions>
    </Activity>

    <Activity Name="ROLValidation" NextActivity="PurchaseOrderSentToVendor" State="ROLValidation" PreviousActivity="PurchaseOrderCreation">
      <Actions>
        <Action Name="Reject" ResultantActivity="PurchaseOrderCreation"/>
        <Action Name="SubmitPurchaseQuantityRequest" ResultantActivity="PurchaseOrderSentToVendor">
          <Conditions>
            <Condition  ResultantActivity="PurchaseOrderSentToVendor" ActionClass="">
              <SubCondition AttributeName="ItemQuantity" ConditionKey="greaterthan" Value1='300' Value2='' DataType='long'/>
            </Condition>
          </Conditions>
        </Action>
      </Actions>
    </Activity>

    <Activity Name="PurchaseOrderSentToVendor" NextActivity="End" State="PurchaseOrderSentToVendor" PreviousActivity="ROLValidation">
      <Actions>
        <Action Name="Reject" ResultantActivity="ROLValidation"/>
        <Action Name="PurchaseOrderCompleted" ResultantActivity="End">
          <Conditions>
            <Condition  ResultantActivity="PurchaseOrderCreation" ActionClass="">
              <SubCondition AttributeName="ItemQuantity" ConditionKey="greaterthan" Value1='500' Value2='' DataType='long'/>
            </Condition>
          </Conditions>
        </Action>
      </Actions>
    </Activity>

    <Activity Name="End" NextActivity="None"  State="WorkflowEnded" PreviousActivity="PurchaseOrderSentToVendor"/>

  </Activities>
</Workflow>
